
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace POSSystem.DAL
{
	public abstract class _Vouchers : SqlClientEntity
	{
		public _Vouchers()
		{
			this.QuerySource = "Vouchers";
			this.MappingName = "Vouchers";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_VouchersLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(Guid ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_VouchersLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.UniqueIdentifier, 0);
				}
			}
			
			public static SqlParameter Code
			{
				get
				{
					return new SqlParameter("@Code", SqlDbType.NVarChar, 20);
				}
			}
			
			public static SqlParameter SerieID
			{
				get
				{
					return new SqlParameter("@SerieID", SqlDbType.UniqueIdentifier, 0);
				}
			}
			
			public static SqlParameter IsUsed
			{
				get
				{
					return new SqlParameter("@IsUsed", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter UsedByCustomerID
			{
				get
				{
					return new SqlParameter("@UsedByCustomerID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter UsedByCustomerName
			{
				get
				{
					return new SqlParameter("@UsedByCustomerName", SqlDbType.NVarChar, 100);
				}
			}
			
			public static SqlParameter Active
			{
				get
				{
					return new SqlParameter("@Active", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Deleted
			{
				get
				{
					return new SqlParameter("@Deleted", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Balance
			{
				get
				{
					return new SqlParameter("@Balance", SqlDbType.Decimal, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string Code = "Code";
            public const string SerieID = "SerieID";
            public const string IsUsed = "IsUsed";
            public const string UsedByCustomerID = "UsedByCustomerID";
            public const string UsedByCustomerName = "UsedByCustomerName";
            public const string Active = "Active";
            public const string Deleted = "Deleted";
            public const string Balance = "Balance";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _Vouchers.PropertyNames.ID;
					ht[Code] = _Vouchers.PropertyNames.Code;
					ht[SerieID] = _Vouchers.PropertyNames.SerieID;
					ht[IsUsed] = _Vouchers.PropertyNames.IsUsed;
					ht[UsedByCustomerID] = _Vouchers.PropertyNames.UsedByCustomerID;
					ht[UsedByCustomerName] = _Vouchers.PropertyNames.UsedByCustomerName;
					ht[Active] = _Vouchers.PropertyNames.Active;
					ht[Deleted] = _Vouchers.PropertyNames.Deleted;
					ht[Balance] = _Vouchers.PropertyNames.Balance;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string Code = "Code";
            public const string SerieID = "SerieID";
            public const string IsUsed = "IsUsed";
            public const string UsedByCustomerID = "UsedByCustomerID";
            public const string UsedByCustomerName = "UsedByCustomerName";
            public const string Active = "Active";
            public const string Deleted = "Deleted";
            public const string Balance = "Balance";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _Vouchers.ColumnNames.ID;
					ht[Code] = _Vouchers.ColumnNames.Code;
					ht[SerieID] = _Vouchers.ColumnNames.SerieID;
					ht[IsUsed] = _Vouchers.ColumnNames.IsUsed;
					ht[UsedByCustomerID] = _Vouchers.ColumnNames.UsedByCustomerID;
					ht[UsedByCustomerName] = _Vouchers.ColumnNames.UsedByCustomerName;
					ht[Active] = _Vouchers.ColumnNames.Active;
					ht[Deleted] = _Vouchers.ColumnNames.Deleted;
					ht[Balance] = _Vouchers.ColumnNames.Balance;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string Code = "s_Code";
            public const string SerieID = "s_SerieID";
            public const string IsUsed = "s_IsUsed";
            public const string UsedByCustomerID = "s_UsedByCustomerID";
            public const string UsedByCustomerName = "s_UsedByCustomerName";
            public const string Active = "s_Active";
            public const string Deleted = "s_Deleted";
            public const string Balance = "s_Balance";

		}
		#endregion		
		
		#region Properties
	
		public virtual Guid ID
	    {
			get
	        {
				return base.GetGuid(ColumnNames.ID);
			}
			set
	        {
				base.SetGuid(ColumnNames.ID, value);
			}
		}

		public virtual string Code
	    {
			get
	        {
				return base.Getstring(ColumnNames.Code);
			}
			set
	        {
				base.Setstring(ColumnNames.Code, value);
			}
		}

		public virtual Guid SerieID
	    {
			get
	        {
				return base.GetGuid(ColumnNames.SerieID);
			}
			set
	        {
				base.SetGuid(ColumnNames.SerieID, value);
			}
		}

		public virtual bool IsUsed
	    {
			get
	        {
				return base.Getbool(ColumnNames.IsUsed);
			}
			set
	        {
				base.Setbool(ColumnNames.IsUsed, value);
			}
		}

		public virtual int UsedByCustomerID
	    {
			get
	        {
				return base.Getint(ColumnNames.UsedByCustomerID);
			}
			set
	        {
				base.Setint(ColumnNames.UsedByCustomerID, value);
			}
		}

		public virtual string UsedByCustomerName
	    {
			get
	        {
				return base.Getstring(ColumnNames.UsedByCustomerName);
			}
			set
	        {
				base.Setstring(ColumnNames.UsedByCustomerName, value);
			}
		}

		public virtual bool Active
	    {
			get
	        {
				return base.Getbool(ColumnNames.Active);
			}
			set
	        {
				base.Setbool(ColumnNames.Active, value);
			}
		}

		public virtual bool Deleted
	    {
			get
	        {
				return base.Getbool(ColumnNames.Deleted);
			}
			set
	        {
				base.Setbool(ColumnNames.Deleted, value);
			}
		}

		public virtual decimal Balance
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.Balance);
			}
			set
	        {
				base.Setdecimal(ColumnNames.Balance, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetGuidAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetGuidAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_Code
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Code) ? string.Empty : base.GetstringAsString(ColumnNames.Code);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Code);
				else
					this.Code = base.SetstringAsString(ColumnNames.Code, value);
			}
		}

		public virtual string s_SerieID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SerieID) ? string.Empty : base.GetGuidAsString(ColumnNames.SerieID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SerieID);
				else
					this.SerieID = base.SetGuidAsString(ColumnNames.SerieID, value);
			}
		}

		public virtual string s_IsUsed
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.IsUsed) ? string.Empty : base.GetboolAsString(ColumnNames.IsUsed);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.IsUsed);
				else
					this.IsUsed = base.SetboolAsString(ColumnNames.IsUsed, value);
			}
		}

		public virtual string s_UsedByCustomerID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.UsedByCustomerID) ? string.Empty : base.GetintAsString(ColumnNames.UsedByCustomerID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.UsedByCustomerID);
				else
					this.UsedByCustomerID = base.SetintAsString(ColumnNames.UsedByCustomerID, value);
			}
		}

		public virtual string s_UsedByCustomerName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.UsedByCustomerName) ? string.Empty : base.GetstringAsString(ColumnNames.UsedByCustomerName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.UsedByCustomerName);
				else
					this.UsedByCustomerName = base.SetstringAsString(ColumnNames.UsedByCustomerName, value);
			}
		}

		public virtual string s_Active
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Active) ? string.Empty : base.GetboolAsString(ColumnNames.Active);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Active);
				else
					this.Active = base.SetboolAsString(ColumnNames.Active, value);
			}
		}

		public virtual string s_Deleted
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Deleted) ? string.Empty : base.GetboolAsString(ColumnNames.Deleted);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Deleted);
				else
					this.Deleted = base.SetboolAsString(ColumnNames.Deleted, value);
			}
		}

		public virtual string s_Balance
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Balance) ? string.Empty : base.GetdecimalAsString(ColumnNames.Balance);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Balance);
				else
					this.Balance = base.SetdecimalAsString(ColumnNames.Balance, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Code
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Code, Parameters.Code);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SerieID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SerieID, Parameters.SerieID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter IsUsed
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.IsUsed, Parameters.IsUsed);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter UsedByCustomerID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.UsedByCustomerID, Parameters.UsedByCustomerID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter UsedByCustomerName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.UsedByCustomerName, Parameters.UsedByCustomerName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Active
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Active, Parameters.Active);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Deleted
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Balance
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Balance, Parameters.Balance);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter Code
		    {
				get
		        {
					if(_Code_W == null)
	        	    {
						_Code_W = TearOff.Code;
					}
					return _Code_W;
				}
			}

			public WhereParameter SerieID
		    {
				get
		        {
					if(_SerieID_W == null)
	        	    {
						_SerieID_W = TearOff.SerieID;
					}
					return _SerieID_W;
				}
			}

			public WhereParameter IsUsed
		    {
				get
		        {
					if(_IsUsed_W == null)
	        	    {
						_IsUsed_W = TearOff.IsUsed;
					}
					return _IsUsed_W;
				}
			}

			public WhereParameter UsedByCustomerID
		    {
				get
		        {
					if(_UsedByCustomerID_W == null)
	        	    {
						_UsedByCustomerID_W = TearOff.UsedByCustomerID;
					}
					return _UsedByCustomerID_W;
				}
			}

			public WhereParameter UsedByCustomerName
		    {
				get
		        {
					if(_UsedByCustomerName_W == null)
	        	    {
						_UsedByCustomerName_W = TearOff.UsedByCustomerName;
					}
					return _UsedByCustomerName_W;
				}
			}

			public WhereParameter Active
		    {
				get
		        {
					if(_Active_W == null)
	        	    {
						_Active_W = TearOff.Active;
					}
					return _Active_W;
				}
			}

			public WhereParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public WhereParameter Balance
		    {
				get
		        {
					if(_Balance_W == null)
	        	    {
						_Balance_W = TearOff.Balance;
					}
					return _Balance_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _Code_W = null;
			private WhereParameter _SerieID_W = null;
			private WhereParameter _IsUsed_W = null;
			private WhereParameter _UsedByCustomerID_W = null;
			private WhereParameter _UsedByCustomerName_W = null;
			private WhereParameter _Active_W = null;
			private WhereParameter _Deleted_W = null;
			private WhereParameter _Balance_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_Code_W = null;
				_SerieID_W = null;
				_IsUsed_W = null;
				_UsedByCustomerID_W = null;
				_UsedByCustomerName_W = null;
				_Active_W = null;
				_Deleted_W = null;
				_Balance_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Code
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Code, Parameters.Code);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SerieID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SerieID, Parameters.SerieID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter IsUsed
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.IsUsed, Parameters.IsUsed);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter UsedByCustomerID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.UsedByCustomerID, Parameters.UsedByCustomerID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter UsedByCustomerName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.UsedByCustomerName, Parameters.UsedByCustomerName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Active
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Active, Parameters.Active);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Deleted
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Balance
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Balance, Parameters.Balance);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter Code
		    {
				get
		        {
					if(_Code_W == null)
	        	    {
						_Code_W = TearOff.Code;
					}
					return _Code_W;
				}
			}

			public AggregateParameter SerieID
		    {
				get
		        {
					if(_SerieID_W == null)
	        	    {
						_SerieID_W = TearOff.SerieID;
					}
					return _SerieID_W;
				}
			}

			public AggregateParameter IsUsed
		    {
				get
		        {
					if(_IsUsed_W == null)
	        	    {
						_IsUsed_W = TearOff.IsUsed;
					}
					return _IsUsed_W;
				}
			}

			public AggregateParameter UsedByCustomerID
		    {
				get
		        {
					if(_UsedByCustomerID_W == null)
	        	    {
						_UsedByCustomerID_W = TearOff.UsedByCustomerID;
					}
					return _UsedByCustomerID_W;
				}
			}

			public AggregateParameter UsedByCustomerName
		    {
				get
		        {
					if(_UsedByCustomerName_W == null)
	        	    {
						_UsedByCustomerName_W = TearOff.UsedByCustomerName;
					}
					return _UsedByCustomerName_W;
				}
			}

			public AggregateParameter Active
		    {
				get
		        {
					if(_Active_W == null)
	        	    {
						_Active_W = TearOff.Active;
					}
					return _Active_W;
				}
			}

			public AggregateParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public AggregateParameter Balance
		    {
				get
		        {
					if(_Balance_W == null)
	        	    {
						_Balance_W = TearOff.Balance;
					}
					return _Balance_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _Code_W = null;
			private AggregateParameter _SerieID_W = null;
			private AggregateParameter _IsUsed_W = null;
			private AggregateParameter _UsedByCustomerID_W = null;
			private AggregateParameter _UsedByCustomerName_W = null;
			private AggregateParameter _Active_W = null;
			private AggregateParameter _Deleted_W = null;
			private AggregateParameter _Balance_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_Code_W = null;
				_SerieID_W = null;
				_IsUsed_W = null;
				_UsedByCustomerID_W = null;
				_UsedByCustomerName_W = null;
				_Active_W = null;
				_Deleted_W = null;
				_Balance_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_VouchersInsert]";
	
			CreateParameters(cmd);
			    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_VouchersUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_VouchersDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Code);
			p.SourceColumn = ColumnNames.Code;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SerieID);
			p.SourceColumn = ColumnNames.SerieID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.IsUsed);
			p.SourceColumn = ColumnNames.IsUsed;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.UsedByCustomerID);
			p.SourceColumn = ColumnNames.UsedByCustomerID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.UsedByCustomerName);
			p.SourceColumn = ColumnNames.UsedByCustomerName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Active);
			p.SourceColumn = ColumnNames.Active;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Deleted);
			p.SourceColumn = ColumnNames.Deleted;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Balance);
			p.SourceColumn = ColumnNames.Balance;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
